<%--
  Created by IntelliJ IDEA.
  User: RE1UY
  Date: 2021/10/16
  Time: 16:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String basePath = request.getScheme() + "://" + request.getServerName()
            + ":" + request.getServerPort() + request.getContextPath() + "/";

    //通过字符串拼接方式完成指定<base>标签内容的拼接
%>
<html>
<head>
    <title>订单页</title>
    <base href="<%=basePath%>"/>
    <script src="/reiCode/js/jquery-3.5.1.js" type="text/javascript"></script>
    <script>
        function dobuy(transactionid) {
            if(confirm("您确定要进行支付吗")){
                window.location.href = "${pageContext.request.contextPath}/transaction/pay.do?transactionid="+transactionid
            }
        }
    </script>
</head>
<body>
<div class="pt">
    <h2 align="center">已支付的订单</h2>
    <table align="center" border="1">
        <tr>
            <th>交易id</th>
            <th>交易时间</th>
            <th>商品名</th>
            <th>商品单价</th>
            <th>商品简介</th>
            <th>商家</th>
            <th>数量</th>
            <th>总价</th>
            <th>状态</th>
        </tr>
    <c:forEach items="${paidtransactioninfos}" var="pt">
        <tr>
            <td>${pt.transactionid}</td>
            <td>${pt.transactiontime}</td>
            <td>${pt.goodname}</td>
            <td>${pt.goodprice}</td>
            <td>${pt.goodintro}</td>
            <td>${pt.username}</td>
            <td>${pt.quantity}</td>
            <td>${pt.totalprice}</td>
            <td>${pt.transactionstate}</td>
        </tr>
    </c:forEach>
    </table>
</div>
<div class="upt">
    <h2 align="center">未支付的订单</h2>
    <table align="center" border="1">
        <tr>
            <th>交易id</th>
            <th>交易时间</th>
            <th>商品名</th>
            <th>商品单价</th>
            <th>商品简介</th>
            <th>商家</th>
            <th>数量</th>
            <th>总价</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${unpaidtransactioninfos}" var="upt">
            <tr>
                <td>${upt.transactionid}</td>
                <td>${upt.transactiontime}</td>
                <td>${upt.goodname}</td>
                <td>${upt.goodprice}</td>
                <td>${upt.goodintro}</td>
                <td>${upt.username}</td>
                <td>${upt.quantity}</td>
                <td>${upt.totalprice}</td>
                <td>${upt.transactionstate}</td>
                <td><input type="button" value="立即付款" onclick="dobuy(${upt.transactionid})"></td>
            </tr>
        </c:forEach>
    </table>
</div>
</body>
</html>
